home *** CD-ROM | disk | FTP | other *** search
- /*
- * MacGzip.c
- * (C) SPDsoft, August 16, 1995
- *
- */
-
-
- /*
- * THINK_C 8.0 extra includes (Not in MacHeaders)
- */
- #include <Aliases.h>
- #include <Sound.h>
-
- #include "Prefs.h"
- #include "FileTypes.h"
- #include "Globals.h"
-
-
- #define kBeepsnd_ID 128
-
- /*
- * Globals
- */
-
-
-
- /*
- * Prototypes
- */
-
- void MyBeep( short sound_id )
- {
- Handle theSound;
-
- if (nil != (theSound = GetResource( soundListRsrc, sound_id )))
- {
- #ifdef __MWERKS__
- (void)SndPlay((SndChannelPtr) nil, (SndListHandle)theSound, false);
- #else
- (void)SndPlay((SndChannelPtr) nil, theSound, false);
- #endif
- ReleaseResource(theSound);
- }
- else
- SysBeep(1);
- }
-
-
- /************************************************************************************
- *
- * SpinCursors by
- * America Online: LISPer
- * Internet: tree@uvm.edu
- */
-
- #define HiWrd(aLong) (((aLong) >> 16) & 0xFFFF)
-
- long int CursLastTime;
-
- acurHandle InitAnimatedCursor(short acurID)
- {
- register short i=0;
- register short cursID;
- Boolean noErrFlag = FALSE;
- acurHandle FrameList = nil;
-
-
- if( nil != (FrameList = (acurHandle) GetResource('acur',acurID)))
- {
- /* got it! */
- noErrFlag = TRUE;
-
- while( ( i < (*FrameList)->numberOfFrames) && noErrFlag )
- {
- /*
- * The id of the cursor is stored in
- * the high word of the frame handle
- */
-
- cursID = (int) HiWrd((long) (*FrameList)->frame[i]);
-
- (*FrameList)->frame[i] = GetCursor(cursID);
-
- if((*FrameList)->frame[i])
- i++; /* get the next one */
- else
- noErrFlag=FALSE; /* foo! we couldn't find the cursor */
- }
- }
-
- if( noErrFlag )
- {
- ZeroAnimatedCursor(FrameList);
- }
- else
- {
- ReleaseAnimatedCursor(&FrameList);
- }
- return FrameList;
- }
-
- void ReleaseAnimatedCursor(acurHandle *FrameListPtr)
- {
- int i;
-
- if(*FrameListPtr != nil)
- {
- for( i=0; i < (**FrameListPtr)->numberOfFrames; i++ )
- if ( (**FrameListPtr)->frame[i] != nil )
- ReleaseResource((Handle) (**FrameListPtr)->frame[i]);
-
- ReleaseResource((Handle) *FrameListPtr);
- }
- *FrameListPtr = nil;
- }
-
-
- void ZeroAnimatedCursor(acurHandle FrameList)
- {
- CursLastTime = TickCount();
- (*FrameList)->whichFrame = 0;
- }
-
- void UpdateAnimatedCursor(acurHandle FrameList, long int nowTicks)
- {
- /*
- * Update cursor
- */
-
- if( nowTicks - CursLastTime > kTicksCursor )
- {
- CursLastTime = nowTicks;
-
- SetCursor(*((*FrameList)->frame[(*FrameList)->whichFrame++]));
-
- if( (*FrameList)->whichFrame == (*FrameList)->numberOfFrames )
- (*FrameList)->whichFrame = 0;
-
- }
- }
-